package com.motorwaymanage.actions;

import java.util.List;

import com.motorwaymanage.beans.JsonObject;
import com.motorwaymanage.beans.LocationInfo;
import com.motorwaymanage.biz.ILocationInfoBiz;
import com.motorwaymanage.impl.LocationInfoBizImpl;
import com.opensymphony.xwork2.ActionSupport;

public class LocationInfoAction extends ActionSupport{

	private static final long serialVersionUID = 1L;
	private ILocationInfoBiz locationInfoBiz=new LocationInfoBizImpl();
	private LocationInfo li;
	private JsonObject json;
	public String AllAddr(){
		List<String> list=locationInfoBiz.selectLaddr();
		System.out.println(list);
		if(list!=null){
			json=new JsonObject();
			json.setRows(list);
			return SUCCESS;
		}else{
			return null;
		}
	}
	
	//获取全部设备的位置信息
	public String getLocationInfo() {
		List<LocationInfo> result = locationInfoBiz.getAllLocationInfo();
		if(result!=null){
			json=new JsonObject();
			json.setRows(result);
			return SUCCESS;
		}else{
			return null;
		}
	}
	
	//添加设备位置信息
	public String addLocationInfo() {
		json = new JsonObject();
		json.setResult(locationInfoBiz.addLocationInfo(li));
		return SUCCESS;
	}
	
	//停用设备
	public String modifyLocation() {
		json = new JsonObject();
		json.setResult(locationInfoBiz.modifyLocation(li));
		return SUCCESS;
	}
	
	public JsonObject getJson() {
		return json;
	}

	public LocationInfo getLi() {
		return li;
	}

	public void setLi(LocationInfo li) {
		this.li = li;
	}

}
